home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 February: Tool Chest / Dev.CD Feb 95 / Dev.CD Feb 95.toast / Sample Code / Snippets / Development Tools & Languages / MouseInfo 1.0.1 / UMouseTrackBehavior.h < prev   
Encoding:
Text File  |  1992-07-15  |  2.1 KB  |  97 lines  |  [TEXT/MPS ]

  1. //     UMouseTrackBehavior.h
  2. //     Copyright © 1992 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TMouseTrackBehavior class definitions
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8. //    <2>        khs        1.0.1    Fixed a memory leak in TMapApplication::GetSleepValue()
  9.  
  10.  
  11. #ifndef __MOUSETRACKBEHAVIOR__
  12. #define __MOUSETRACKBEHAVIOR__
  13.  
  14.  
  15. #ifndef __BEHAVIOR__
  16. #include <UBehavior.h>
  17. #endif
  18.  
  19. #ifndef __FLOATWINDOW__
  20. #include <UFloatWindow.h>
  21. #endif
  22.  
  23. #ifndef __PACKAGES__
  24. #include <Packages.h>
  25. #endif
  26.  
  27. #ifndef __RESOURCECONSTANTS__
  28. #include "ResourceConstants.h"
  29. #endif
  30.  
  31. // FORWARD STATEMENTS
  32. class TMouseTrackBehavior;
  33. class TSwallowBehavior;
  34. class TTrackWindow;
  35.  
  36.  
  37. // GLOBALS
  38. const IDType kMouseTrackBehavior = 'MTRB';
  39.  
  40. TTrackWindow* gMouseTrackWindow = NULL;            // global TrackWindow hook (one and only)
  41.  
  42. pascal void InitMouseTrackBehavior();            // initialize our nice behavior (called once)
  43.  
  44.  
  45. //    CLASSES
  46. // floating window used for presentation of the mouse information
  47. class TTrackWindow : public TFloatWindow
  48. {
  49. public:
  50.     virtual pascal void Close();
  51.     virtual pascal void GetOriginatorBehavior(TSwallowBehavior*);
  52.  
  53.     TSwallowBehavior* fBehavior;
  54. };
  55.  
  56.  
  57. //    our event swallow behavior, swallows everything
  58. class TSwallowBehavior : public TBehavior
  59. {
  60. public:
  61.     virtual pascal void ISwallowBehavior();
  62.     virtual pascal Boolean DoToolboxEvent(TToolboxEvent* event);
  63.     virtual pascal void Draw(const VRect& area);
  64.  
  65.     //    FIELDS
  66.     TTrackWindow* fTrackWindow;
  67.     TStaticText* fMouseStatus;
  68.     TStaticText* fVertical;
  69.     TStaticText* fHorizontal;
  70.     VPoint fMouseVPoint;
  71.     short fEventType;
  72. };
  73.  
  74.  
  75. //    the main behavior, which will coordinate swallow behavior and other objects
  76. class TMouseTrackBehavior : public TBehavior
  77. {
  78. public:
  79.     virtual pascal void IMouseTrackBehavior(ResNumber menuID);
  80.     virtual pascal void Initialize();
  81.  
  82.     virtual pascal void DoSetupMenus();
  83.     virtual pascal void DoMenuCommand(CommandNumber);
  84.     virtual pascal void CreateSwallowBehavior();
  85.     virtual pascal void CreateWindoid();
  86.  
  87.     //    FIELDS
  88.     short fMenuID;
  89.     TTrackWindow* fWindoid;
  90. };
  91.  
  92.  
  93.  
  94.  
  95. #endif __MOUSETRACKBEHAVIOR__
  96.  
  97.